\(\int x^3 (a+b \tan (c+d x^2))^2 \, dx\) [7]

   Optimal result
   Rubi [A] (verified)
   Mathematica [A] (verified)
   Maple [F]
   Fricas [A] (verification not implemented)
   Sympy [F]
   Maxima [B] (verification not implemented)
   Giac [F]
   Mupad [F(-1)]

Optimal result

Integrand size = 18, antiderivative size = 126 \[ \int x^3 \left (a+b \tan \left (c+d x^2\right )\right )^2 \, dx=\frac {a^2 x^4}{4}+\frac {1}{2} i a b x^4-\frac {b^2 x^4}{4}-\frac {a b x^2 \log \left (1+e^{2 i \left (c+d x^2\right )}\right )}{d}+\frac {b^2 \log \left (\cos \left (c+d x^2\right )\right )}{2 d^2}+\frac {i a b \operatorname {PolyLog}\left (2,-e^{2 i \left (c+d x^2\right )}\right )}{2 d^2}+\frac {b^2 x^2 \tan \left (c+d x^2\right )}{2 d} \]

[Out]

1/4*a^2*x^4+1/2*I*a*b*x^4-1/4*b^2*x^4-a*b*x^2*ln(1+exp(2*I*(d*x^2+c)))/d+1/2*b^2*ln(cos(d*x^2+c))/d^2+1/2*I*a*
b*polylog(2,-exp(2*I*(d*x^2+c)))/d^2+1/2*b^2*x^2*tan(d*x^2+c)/d

Rubi [A] (verified)

Time = 0.27 (sec) , antiderivative size = 126, normalized size of antiderivative = 1.00, number of steps used = 10, number of rules used = 9, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.500, Rules used = {3832, 3803, 3800, 2221, 2317, 2438, 3801, 3556, 30} \[ \int x^3 \left (a+b \tan \left (c+d x^2\right )\right )^2 \, dx=\frac {a^2 x^4}{4}+\frac {i a b \operatorname {PolyLog}\left (2,-e^{2 i \left (d x^2+c\right )}\right )}{2 d^2}-\frac {a b x^2 \log \left (1+e^{2 i \left (c+d x^2\right )}\right )}{d}+\frac {1}{2} i a b x^4+\frac {b^2 \log \left (\cos \left (c+d x^2\right )\right )}{2 d^2}+\frac {b^2 x^2 \tan \left (c+d x^2\right )}{2 d}-\frac {b^2 x^4}{4} \]

[In]

Int[x^3*(a + b*Tan[c + d*x^2])^2,x]

[Out]

(a^2*x^4)/4 + (I/2)*a*b*x^4 - (b^2*x^4)/4 - (a*b*x^2*Log[1 + E^((2*I)*(c + d*x^2))])/d + (b^2*Log[Cos[c + d*x^
2]])/(2*d^2) + ((I/2)*a*b*PolyLog[2, -E^((2*I)*(c + d*x^2))])/d^2 + (b^2*x^2*Tan[c + d*x^2])/(2*d)

Rule 30

Int[(x_)^(m_.), x_Symbol] :> Simp[x^(m + 1)/(m + 1), x] /; FreeQ[m, x] && NeQ[m, -1]

Rule 2221

Int[(((F_)^((g_.)*((e_.) + (f_.)*(x_))))^(n_.)*((c_.) + (d_.)*(x_))^(m_.))/((a_) + (b_.)*((F_)^((g_.)*((e_.) +
 (f_.)*(x_))))^(n_.)), x_Symbol] :> Simp[((c + d*x)^m/(b*f*g*n*Log[F]))*Log[1 + b*((F^(g*(e + f*x)))^n/a)], x]
 - Dist[d*(m/(b*f*g*n*Log[F])), Int[(c + d*x)^(m - 1)*Log[1 + b*((F^(g*(e + f*x)))^n/a)], x], x] /; FreeQ[{F,
a, b, c, d, e, f, g, n}, x] && IGtQ[m, 0]

Rule 2317

Int[Log[(a_) + (b_.)*((F_)^((e_.)*((c_.) + (d_.)*(x_))))^(n_.)], x_Symbol] :> Dist[1/(d*e*n*Log[F]), Subst[Int
[Log[a + b*x]/x, x], x, (F^(e*(c + d*x)))^n], x] /; FreeQ[{F, a, b, c, d, e, n}, x] && GtQ[a, 0]

Rule 2438

Int[Log[(c_.)*((d_) + (e_.)*(x_)^(n_.))]/(x_), x_Symbol] :> Simp[-PolyLog[2, (-c)*e*x^n]/n, x] /; FreeQ[{c, d,
 e, n}, x] && EqQ[c*d, 1]

Rule 3556

Int[tan[(c_.) + (d_.)*(x_)], x_Symbol] :> Simp[-Log[RemoveContent[Cos[c + d*x], x]]/d, x] /; FreeQ[{c, d}, x]

Rule 3800

Int[((c_.) + (d_.)*(x_))^(m_.)*tan[(e_.) + (f_.)*(x_)], x_Symbol] :> Simp[I*((c + d*x)^(m + 1)/(d*(m + 1))), x
] - Dist[2*I, Int[(c + d*x)^m*(E^(2*I*(e + f*x))/(1 + E^(2*I*(e + f*x)))), x], x] /; FreeQ[{c, d, e, f}, x] &&
 IGtQ[m, 0]

Rule 3801

Int[((c_.) + (d_.)*(x_))^(m_.)*((b_.)*tan[(e_.) + (f_.)*(x_)])^(n_), x_Symbol] :> Simp[b*(c + d*x)^m*((b*Tan[e
 + f*x])^(n - 1)/(f*(n - 1))), x] + (-Dist[b*d*(m/(f*(n - 1))), Int[(c + d*x)^(m - 1)*(b*Tan[e + f*x])^(n - 1)
, x], x] - Dist[b^2, Int[(c + d*x)^m*(b*Tan[e + f*x])^(n - 2), x], x]) /; FreeQ[{b, c, d, e, f}, x] && GtQ[n,
1] && GtQ[m, 0]

Rule 3803

Int[((c_.) + (d_.)*(x_))^(m_.)*((a_) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(n_.), x_Symbol] :> Int[ExpandIntegrand[
(c + d*x)^m, (a + b*Tan[e + f*x])^n, x], x] /; FreeQ[{a, b, c, d, e, f, m}, x] && IGtQ[m, 0] && IGtQ[n, 0]

Rule 3832

Int[(x_)^(m_.)*((a_.) + (b_.)*Tan[(c_.) + (d_.)*(x_)^(n_)])^(p_.), x_Symbol] :> Dist[1/n, Subst[Int[x^(Simplif
y[(m + 1)/n] - 1)*(a + b*Tan[c + d*x])^p, x], x, x^n], x] /; FreeQ[{a, b, c, d, m, n, p}, x] && IGtQ[Simplify[
(m + 1)/n], 0] && IntegerQ[p]

Rubi steps \begin{align*} \text {integral}& = \frac {1}{2} \text {Subst}\left (\int x (a+b \tan (c+d x))^2 \, dx,x,x^2\right ) \\ & = \frac {1}{2} \text {Subst}\left (\int \left (a^2 x+2 a b x \tan (c+d x)+b^2 x \tan ^2(c+d x)\right ) \, dx,x,x^2\right ) \\ & = \frac {a^2 x^4}{4}+(a b) \text {Subst}\left (\int x \tan (c+d x) \, dx,x,x^2\right )+\frac {1}{2} b^2 \text {Subst}\left (\int x \tan ^2(c+d x) \, dx,x,x^2\right ) \\ & = \frac {a^2 x^4}{4}+\frac {1}{2} i a b x^4+\frac {b^2 x^2 \tan \left (c+d x^2\right )}{2 d}-(2 i a b) \text {Subst}\left (\int \frac {e^{2 i (c+d x)} x}{1+e^{2 i (c+d x)}} \, dx,x,x^2\right )-\frac {1}{2} b^2 \text {Subst}\left (\int x \, dx,x,x^2\right )-\frac {b^2 \text {Subst}\left (\int \tan (c+d x) \, dx,x,x^2\right )}{2 d} \\ & = \frac {a^2 x^4}{4}+\frac {1}{2} i a b x^4-\frac {b^2 x^4}{4}-\frac {a b x^2 \log \left (1+e^{2 i \left (c+d x^2\right )}\right )}{d}+\frac {b^2 \log \left (\cos \left (c+d x^2\right )\right )}{2 d^2}+\frac {b^2 x^2 \tan \left (c+d x^2\right )}{2 d}+\frac {(a b) \text {Subst}\left (\int \log \left (1+e^{2 i (c+d x)}\right ) \, dx,x,x^2\right )}{d} \\ & = \frac {a^2 x^4}{4}+\frac {1}{2} i a b x^4-\frac {b^2 x^4}{4}-\frac {a b x^2 \log \left (1+e^{2 i \left (c+d x^2\right )}\right )}{d}+\frac {b^2 \log \left (\cos \left (c+d x^2\right )\right )}{2 d^2}+\frac {b^2 x^2 \tan \left (c+d x^2\right )}{2 d}-\frac {(i a b) \text {Subst}\left (\int \frac {\log (1+x)}{x} \, dx,x,e^{2 i \left (c+d x^2\right )}\right )}{2 d^2} \\ & = \frac {a^2 x^4}{4}+\frac {1}{2} i a b x^4-\frac {b^2 x^4}{4}-\frac {a b x^2 \log \left (1+e^{2 i \left (c+d x^2\right )}\right )}{d}+\frac {b^2 \log \left (\cos \left (c+d x^2\right )\right )}{2 d^2}+\frac {i a b \operatorname {PolyLog}\left (2,-e^{2 i \left (c+d x^2\right )}\right )}{2 d^2}+\frac {b^2 x^2 \tan \left (c+d x^2\right )}{2 d} \\ \end{align*}

Mathematica [A] (verified)

Time = 5.23 (sec) , antiderivative size = 236, normalized size of antiderivative = 1.87 \[ \int x^3 \left (a+b \tan \left (c+d x^2\right )\right )^2 \, dx=\frac {\sec (c) \left (-2 a b \cos (c) \left (i d x^2 (\pi +2 \arctan (\cot (c)))+\pi \log \left (1+e^{-2 i d x^2}\right )+2 \left (d x^2-\arctan (\cot (c))\right ) \log \left (1-e^{2 i \left (d x^2-\arctan (\cot (c))\right )}\right )-\pi \log \left (\cos \left (d x^2\right )\right )+2 \arctan (\cot (c)) \log \left (\sin \left (d x^2-\arctan (\cot (c))\right )\right )-i \operatorname {PolyLog}\left (2,e^{2 i \left (d x^2-\arctan (\cot (c))\right )}\right )\right )-2 a b d^2 e^{-i \arctan (\cot (c))} x^4 \sqrt {\csc ^2(c)} \sin (c)+d^2 x^4 \left (\left (a^2-b^2\right ) \cos (c)+2 a b \sin (c)\right )+2 b^2 \left (\cos (c) \log \left (\cos \left (c+d x^2\right )\right )+d x^2 \sin (c)\right )+2 b^2 d x^2 \sec \left (c+d x^2\right ) \sin \left (d x^2\right )\right )}{4 d^2} \]

[In]

Integrate[x^3*(a + b*Tan[c + d*x^2])^2,x]

[Out]

(Sec[c]*(-2*a*b*Cos[c]*(I*d*x^2*(Pi + 2*ArcTan[Cot[c]]) + Pi*Log[1 + E^((-2*I)*d*x^2)] + 2*(d*x^2 - ArcTan[Cot
[c]])*Log[1 - E^((2*I)*(d*x^2 - ArcTan[Cot[c]]))] - Pi*Log[Cos[d*x^2]] + 2*ArcTan[Cot[c]]*Log[Sin[d*x^2 - ArcT
an[Cot[c]]]] - I*PolyLog[2, E^((2*I)*(d*x^2 - ArcTan[Cot[c]]))]) - (2*a*b*d^2*x^4*Sqrt[Csc[c]^2]*Sin[c])/E^(I*
ArcTan[Cot[c]]) + d^2*x^4*((a^2 - b^2)*Cos[c] + 2*a*b*Sin[c]) + 2*b^2*(Cos[c]*Log[Cos[c + d*x^2]] + d*x^2*Sin[
c]) + 2*b^2*d*x^2*Sec[c + d*x^2]*Sin[d*x^2]))/(4*d^2)

Maple [F]

\[\int x^{3} {\left (a +b \tan \left (d \,x^{2}+c \right )\right )}^{2}d x\]

[In]

int(x^3*(a+b*tan(d*x^2+c))^2,x)

[Out]

int(x^3*(a+b*tan(d*x^2+c))^2,x)

Fricas [A] (verification not implemented)

none

Time = 0.25 (sec) , antiderivative size = 199, normalized size of antiderivative = 1.58 \[ \int x^3 \left (a+b \tan \left (c+d x^2\right )\right )^2 \, dx=\frac {{\left (a^{2} - b^{2}\right )} d^{2} x^{4} + 2 \, b^{2} d x^{2} \tan \left (d x^{2} + c\right ) - i \, a b {\rm Li}_2\left (\frac {2 \, {\left (i \, \tan \left (d x^{2} + c\right ) - 1\right )}}{\tan \left (d x^{2} + c\right )^{2} + 1} + 1\right ) + i \, a b {\rm Li}_2\left (\frac {2 \, {\left (-i \, \tan \left (d x^{2} + c\right ) - 1\right )}}{\tan \left (d x^{2} + c\right )^{2} + 1} + 1\right ) - {\left (2 \, a b d x^{2} - b^{2}\right )} \log \left (-\frac {2 \, {\left (i \, \tan \left (d x^{2} + c\right ) - 1\right )}}{\tan \left (d x^{2} + c\right )^{2} + 1}\right ) - {\left (2 \, a b d x^{2} - b^{2}\right )} \log \left (-\frac {2 \, {\left (-i \, \tan \left (d x^{2} + c\right ) - 1\right )}}{\tan \left (d x^{2} + c\right )^{2} + 1}\right )}{4 \, d^{2}} \]

[In]

integrate(x^3*(a+b*tan(d*x^2+c))^2,x, algorithm="fricas")

[Out]

1/4*((a^2 - b^2)*d^2*x^4 + 2*b^2*d*x^2*tan(d*x^2 + c) - I*a*b*dilog(2*(I*tan(d*x^2 + c) - 1)/(tan(d*x^2 + c)^2
 + 1) + 1) + I*a*b*dilog(2*(-I*tan(d*x^2 + c) - 1)/(tan(d*x^2 + c)^2 + 1) + 1) - (2*a*b*d*x^2 - b^2)*log(-2*(I
*tan(d*x^2 + c) - 1)/(tan(d*x^2 + c)^2 + 1)) - (2*a*b*d*x^2 - b^2)*log(-2*(-I*tan(d*x^2 + c) - 1)/(tan(d*x^2 +
 c)^2 + 1)))/d^2

Sympy [F]

\[ \int x^3 \left (a+b \tan \left (c+d x^2\right )\right )^2 \, dx=\int x^{3} \left (a + b \tan {\left (c + d x^{2} \right )}\right )^{2}\, dx \]

[In]

integrate(x**3*(a+b*tan(d*x**2+c))**2,x)

[Out]

Integral(x**3*(a + b*tan(c + d*x**2))**2, x)

Maxima [B] (verification not implemented)

Both result and optimal contain complex but leaf count of result is larger than twice the leaf count of optimal. 398 vs. \(2 (105) = 210\).

Time = 0.35 (sec) , antiderivative size = 398, normalized size of antiderivative = 3.16 \[ \int x^3 \left (a+b \tan \left (c+d x^2\right )\right )^2 \, dx=\frac {1}{4} \, a^{2} x^{4} + \frac {{\left (2 \, a b + i \, b^{2}\right )} d^{2} x^{4} - 2 \, {\left (2 \, a b d x^{2} - b^{2} + {\left (2 \, a b d x^{2} - b^{2}\right )} \cos \left (2 \, d x^{2} + 2 \, c\right ) - {\left (-2 i \, a b d x^{2} + i \, b^{2}\right )} \sin \left (2 \, d x^{2} + 2 \, c\right )\right )} \arctan \left (\sin \left (2 \, d x^{2} + 2 \, c\right ), \cos \left (2 \, d x^{2} + 2 \, c\right ) + 1\right ) + {\left ({\left (2 \, a b + i \, b^{2}\right )} d^{2} x^{4} - 4 \, b^{2} d x^{2}\right )} \cos \left (2 \, d x^{2} + 2 \, c\right ) + 2 \, {\left (a b \cos \left (2 \, d x^{2} + 2 \, c\right ) + i \, a b \sin \left (2 \, d x^{2} + 2 \, c\right ) + a b\right )} {\rm Li}_2\left (-e^{\left (2 i \, d x^{2} + 2 i \, c\right )}\right ) - {\left (-2 i \, a b d x^{2} + i \, b^{2} + {\left (-2 i \, a b d x^{2} + i \, b^{2}\right )} \cos \left (2 \, d x^{2} + 2 \, c\right ) + {\left (2 \, a b d x^{2} - b^{2}\right )} \sin \left (2 \, d x^{2} + 2 \, c\right )\right )} \log \left (\cos \left (2 \, d x^{2} + 2 \, c\right )^{2} + \sin \left (2 \, d x^{2} + 2 \, c\right )^{2} + 2 \, \cos \left (2 \, d x^{2} + 2 \, c\right ) + 1\right ) - {\left ({\left (-2 i \, a b + b^{2}\right )} d^{2} x^{4} + 4 i \, b^{2} d x^{2}\right )} \sin \left (2 \, d x^{2} + 2 \, c\right )}{-4 i \, d^{2} \cos \left (2 \, d x^{2} + 2 \, c\right ) + 4 \, d^{2} \sin \left (2 \, d x^{2} + 2 \, c\right ) - 4 i \, d^{2}} \]

[In]

integrate(x^3*(a+b*tan(d*x^2+c))^2,x, algorithm="maxima")

[Out]

1/4*a^2*x^4 + ((2*a*b + I*b^2)*d^2*x^4 - 2*(2*a*b*d*x^2 - b^2 + (2*a*b*d*x^2 - b^2)*cos(2*d*x^2 + 2*c) - (-2*I
*a*b*d*x^2 + I*b^2)*sin(2*d*x^2 + 2*c))*arctan2(sin(2*d*x^2 + 2*c), cos(2*d*x^2 + 2*c) + 1) + ((2*a*b + I*b^2)
*d^2*x^4 - 4*b^2*d*x^2)*cos(2*d*x^2 + 2*c) + 2*(a*b*cos(2*d*x^2 + 2*c) + I*a*b*sin(2*d*x^2 + 2*c) + a*b)*dilog
(-e^(2*I*d*x^2 + 2*I*c)) - (-2*I*a*b*d*x^2 + I*b^2 + (-2*I*a*b*d*x^2 + I*b^2)*cos(2*d*x^2 + 2*c) + (2*a*b*d*x^
2 - b^2)*sin(2*d*x^2 + 2*c))*log(cos(2*d*x^2 + 2*c)^2 + sin(2*d*x^2 + 2*c)^2 + 2*cos(2*d*x^2 + 2*c) + 1) - ((-
2*I*a*b + b^2)*d^2*x^4 + 4*I*b^2*d*x^2)*sin(2*d*x^2 + 2*c))/(-4*I*d^2*cos(2*d*x^2 + 2*c) + 4*d^2*sin(2*d*x^2 +
 2*c) - 4*I*d^2)

Giac [F]

\[ \int x^3 \left (a+b \tan \left (c+d x^2\right )\right )^2 \, dx=\int { {\left (b \tan \left (d x^{2} + c\right ) + a\right )}^{2} x^{3} \,d x } \]

[In]

integrate(x^3*(a+b*tan(d*x^2+c))^2,x, algorithm="giac")

[Out]

integrate((b*tan(d*x^2 + c) + a)^2*x^3, x)

Mupad [F(-1)]

Timed out. \[ \int x^3 \left (a+b \tan \left (c+d x^2\right )\right )^2 \, dx=\int x^3\,{\left (a+b\,\mathrm {tan}\left (d\,x^2+c\right )\right )}^2 \,d x \]

[In]

int(x^3*(a + b*tan(c + d*x^2))^2,x)

[Out]

int(x^3*(a + b*tan(c + d*x^2))^2, x)